using System;
using System.Drawing.Drawing2D;
using System.Data;
using System.Data.Odbc;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class V2Controls_Top10ameldelser : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        Table Tbl = new Table();
        TableRow TrTop = new TableRow();
        TableCell TdTop = new TableCell();
        Tbl.CellPadding = 0;
        Tbl.CellSpacing = 0;
        Tbl.BorderColor = System.Drawing.Color.Black;
        Tbl.BorderWidth = 1;
        Tbl.BorderStyle = BorderStyle.Solid;
        TdTop.CssClass = "TD_red";
        TdTop.Text = "&nbsp;Seneste Spil";
        TrTop.Cells.Add(TdTop);
        Tbl.Rows.Add(TrTop);

        OdbcDataReader MyReader = ReviewerOdbc.Read("SELECT V2_Spil.Titel, V2_Spil.SpilID, V2_Spil.ID, V2_GloGenres.Navn FROM  `V2_Spil` JOIN V2_GloGenres ON V2_GloGenres.ID = V2_Spil.Genre GROUP BY V2_Spil.Titel ORDER BY V2_Spil.ID DESC  LIMIT 10");
        string Titel;
        while (MyReader.Read())
        {
            DateFromMySql DateHandler = new DateFromMySql();
            Titel = MyReader[0].ToString();

            if (Titel.Length > 30)
            {
                Titel = Titel.Substring(0, 30) + "...";
            }
            TableRow Tr2 = new TableRow();
            TableCell Td2 = new TableCell();
            Td2.Text = String.Format(
                "<a href=\"{0}\" style=\"color:black;\">{1}<br />{2}</a>"
                , UI.LinkMake.LinkSpil(MyReader["ID"].ToString(), MyReader["Titel"].ToString()) //Link
                , Titel //Link Text
                , MyReader["Navn"].ToString()); // Gametype Text
            //Td2.Text = "<a href=\"" + UI.LinkMake.LinkSpil(MyReader["ID"].ToString(), MyReader["Titel"].ToString()) + "\" style=\"color:black;\">" + Titel + "<br />" + MyReader["Navn"].ToString();
            Td2.CssClass = "TD_Top10";
            Td2.VerticalAlign = VerticalAlign.Top;
            Tr2.Cells.Add(Td2);
            Tbl.Rows.Add(Tr2);
        }

        Top10Holder.Controls.Add(Tbl);
    }
}
